package com.usian.service.impl;

import com.usian.mapper.StudentMapper;
import com.usian.pojo.Student;
import com.usian.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public void addStu(Student student) {
        //studentMapper.addStu(student);
        studentMapper.insert(student);
    }

    @Override
    public List<Student> findAll() {
        //return studentMapper.findAll();
        return studentMapper.selectAll();
    }

    @Override
    public void updateStu(Student student) {
        //studentMapper.updateStu(student);
        studentMapper.updateByPrimaryKeySelective(student);
    }

    @Override
    public void delStu(Integer id) {
        //studentMapper.delStu(id);
        studentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Student findById(Integer id) {
        return studentMapper.findById(id);
    }
}
